home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
dax1.exe
/
DAP
/
DAP010.C
< prev
next >
Wrap
Text File
|
1992-07-15
|
5KB
|
121 lines
// ╔════════════════════════════════════════════════════════════════════╗
// ║ ║
// ║ module: dap010.c ║
// ║ abstract: This module contains DAP Request 1010 ║
// ║ ║
// ║ environment: NetWare 3.x v3.11 ║
// ║ Network C for NLMs SDK ║
// ║ CLib v3.11 ║
// ║ Network C for DOS v2.0 ║
// ║ NetWare C Interface DOS v1.2 ║
// ║ ║
// ║ This software is provided as is and carries no warranty ║
// ║ whatsoever. Novell disclaims and excludes any and all implied ║
// ║ warranties of merchantability, title and fitness for a particular ║
// ║ purpose. Novell does not warrant that the software will satisfy ║
// ║ your requirements or that the software is without defect or error ║
// ║ or that operation of the software will be uninterrupted. You are ║
// ║ using the software at your risk. The software is not a product ║
// ║ of Novell, Inc. or any of subsidiaries. ║
// ║ ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ maintenance history: ║
// ║ level date pi description ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ 001 01/15/92 kl initial release. ║
// ╚════════════════════════════════════════════════════════════════════╝
#include <string.h>
#include "dap/dapsys.h"
#include "cp/cpapi.h"
//
// The following are the request/reply structures for the AllocateSession
// DAP.
//
typedef struct{ // allocate session request pkt
UINT32 dummy;
}ASRequest;
typedef struct{ // allocate session reply pkt
UINT32 sessionID; // session number assigned
}ASReply;
#if !defined(ENGINE)
//
// Following is the Client-Side API for AllocateSession
//
// DAPid - this is obtained from DAPInitialize. It is
// normally a pointer to some sort of structure
// containing info needed to connect to the server.
//
T_RC DAPAllocateSession(DAPDATA *DAPid)
{
T_RC rc;
ASReply *reply = (ASReply *)DAPid->dapReply.data;
if( CPConnectToServer(DAPid->CPid) ) return DAP_CANT_CONNECT;
memset(&DAPid->dapRequest,'\0',sizeof DAPid->dapRequest);
memset(&DAPid->dapReply,'\0',sizeof DAPid->dapReply);
//
// Set the sessionID field in the DAPid structure to 0.
// This signals the engine to allocate a new session for
// this client.
//
DAPid->sessionID = 0;
//
// Send the request to the application server
//
rc = DAPSendRequest(DAPid,DAPALLOCATESESSION);
//
// Extract and save the sessionID for subsequent requests...
//
DAPid->sessionID = reply->sessionID;
return rc;
}
#else // !defined(ENGINE)
//
// Following is the Server-Side API for AllocateSession
//
void DAPAllocateSession(DAPDATA *DAPid)
{
ASReply *reply = (ASReply *)DAPid->dapReply.data;
DIAG4("Inside AllocateSession DAP");
//
// Initialize the application control structure
//
memset(DAPGetApplDataAreaPtr(DAPid),'\0',sizeof DAPGetApplDataStructure(DAPid));
//
// The DAPEnqueueServiceRequest updates the sessionID in the
// request packet when a new slot is allocated. We need to
// give this to the client for subsequent requests.
//
reply->sessionID = DAPid->dapRequest.sessionID;
//
// Set the DAP return code
//
DAPid->dapReply.returnCode = 0;
//
// Update the TotalLoginRequests Statistic, but only if the client
// has not previously logged in successfully. This keeps us from
// recounting a retry, if the client never received our reply to
// the first request.
//
if( !DAPStateActive(DAPid,DAP_CLIENTLOGIN) ){
DAPStateON(DAPid,DAP_CLIENTLOGIN);
DAPIncLoginRequests();
}
//
// Now send the result to the client
//
DAPEnqueueServiceReply(DAPid);
}
#endif // !defined(ENGINE)